package com.zsl.casuallyheart.contacts;
import java.util.List;

import cn.bmob.im.BmobUserManager;
import cn.bmob.im.bean.BmobChatUser;
import cn.bmob.v3.listener.FindListener;

import com.zsl.casuallyheart.AppBaseActivity;
import com.zsl.casuallyheart.R;
import com.zsl.casuallyheart.util.SetTitle;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Toast;

/**
 * 通用类
 * @author zsl
 * @date 2014-10-2下午5:37:17
 * @version v1.0
 */
public class ContactsActivity extends AppBaseActivity{
	
	/**
	 * 控件
	 */
	private TextView title_tv_add;
	private TextView title_tv_title;
	
	/**
	 * 数据
	 */
	String addTexT="添加";
	String titleTexT="好友";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tabhost_contacts);
		initView();
		initData();
		BmobUserManager.getInstance(this).queryCurrentContactList(new FindListener<BmobChatUser>() {
			
			@Override
			public void onSuccess(List<BmobChatUser> arg0) {
				// TODO Auto-generated method stub
				Toast.makeText(getApplicationContext(), "获取成功"+arg0,Toast.LENGTH_LONG).show();
			}
			
			@Override
			public void onError(int arg0, String arg1) {
				// TODO Auto-generated method stub
				Toast.makeText(getApplicationContext(), "获取失败"+arg0+arg1,Toast.LENGTH_LONG).show();
			}
		});
		
	}
	/**
	 * 初始化控件
	 */
	private void initView(){
		//添加好友
		title_tv_add=(TextView) findViewById(R.id.layout_title_tv_right);
		title_tv_add.setText(addTexT);
		title_tv_add.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(ContactsActivity.this, AddContants.class);
				startActivity(intent);
				
			}
		});
		//标题
		title_tv_title=(TextView) findViewById(R.id.layout_title_tv_title);
		title_tv_title.setText(titleTexT);
		
		
		
	}
	/**
	 * 初始化数据
	 */
	private void initData(){
	}
	
	
	
	
	
	
}
